package com.dt76.smallloanbackendservice.controller.hzp;

        import com.dt76.smallloanbackendservice.pojo.hzp.HLoanMaterial;
        import com.dt76.smallloanbackendservice.service.hzp.HLoanMaterialService;
        import com.dt76.smallloanbackendservice.utils.Page;
        import com.dt76.smallloanbackendservice.utils.Result;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.RequestBody;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RequestParam;
        import org.springframework.web.bind.annotation.RestController;

        import java.util.List;


@RestController
@RequestMapping("/hzp")
public class HLoanMaterialController {
    //贷款材料表
    @Autowired
    private HLoanMaterialService loanMaterialService;

    @RequestMapping("/loanMaterial")
    public List<HLoanMaterial> qryAllHLoanMaterial() {
        System.out.println(loanMaterialService.qryAllHLMM());
        return loanMaterialService.qryAllHLMM();
    }

    @RequestMapping("/getPage")
    public Page qryPageHLoanMaterial(Integer pageIndex, Integer pageSize) {
        Page page = new Page();
        page.setPageIndex(pageIndex);

        Page page1 = loanMaterialService.qryPageHLMM(page);
        return page1;
    }

//    @RequestMapping("/findOne")
//    public HLoanMaterial findOne(@RequestParam("materialId") int materialId) {
//        return loanMaterialService.getById(materialId);
//    }
//
//    @RequestMapping("/add")
//    public Result add(@RequestBody HLoanMaterial hLoanMaterial) {
//        try {
//            if (hLoanMaterial.getMaterialId() == 0) {
//                loanMaterialService.addNewHLMM(hLoanMaterial);
//                return new Result(true, "新增成功");
//            }
//        } catch (Exception e) {
//            return new Result(false, "新增异常");
//        }
//    }
}
